/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Negocio;

/**
 *
 * @author Estudiante
 */
public class Entero {
    private int Num;
    public int getNum() {
        return Num;
    }    
    public void setNum(int Num) {
        this.Num = Num;
    }
    public boolean Par()
    {
        return Num % 2 == 0;
    }
    public long Factorial()
    {
        try
        {
            long ac = 1;
            for( int i=1; i<=Num; i++)
            {
                ac=ac*i;
            }
            return ac;
        }
        catch(Exception a)
        {
            return 0;
        }
    }
    public Boolean Primo()
    {
        if(Num == 1)
        {
            return false;
        }
        else
        {
            for(int i = 2;i <= Num; i++)
            {
                if((Num % i) == 0)
                {
                    if(Num == i)
                    {
                        return true;
                    }
                    else
                    {
                        return false;
                    }
                }
            }
        }
        return false;
    }
    public int Invertir()
    {
        int aux = Num;
        int ac = 0;
        while(Num > 0)
        {
            int residuo = Num % 10;
            ac = ac*10 + residuo;
            Num = Num / 10;
        }
        Num = aux;
        return ac;
    }
    public boolean Capicua()
    {
        return Num == this.Invertir();
    }
    public int EliminarDigitoPrimos()
    {
        int aux = Num;
        int ac = 0;
        while(Num > 0)
        {
            int residuo = Num % 10;
            Entero obj2 = new Entero();
            obj2.setNum(residuo);
            if(!obj2.Primo())
            {
                ac = ac*10 + residuo;
            }
            Num = Num / 10;
        }        
        Num = aux;
        return ac;
    }
}
